dataComet allows you to record macros to perform functions such as moving the cursor, making a selection, or appending the selection to a file. Macros can be entered and executed in the .edit window. Pressing the Enter key while the .edit window is the frontmost window causes the current line or selection to be executed as a macro.
Dialogs in the Macro menu allow you to paste in or enter a sequence of macro commands; you can trigger a macro with key-combinations (such as Control Option A) you enter on the keyboard or the mouse single- or double-click (using ("Define key macros" or "Set double-click macro" in the Control menu). You can also define a macro to execute when a connection with a host is complete ("Set Connection macro...") or when the user closes the connection ("Set Close macro...").
The Key Macro on/off switch is in the Macro menu; when macros are on, an M appears in a box on the top left hand side of the screen. When a key macro is currently executing, the M appears in reverse video; the reverse M also appears if keystrokes are pending execution in the key queue. If you wish to cancel the execution of a macro or pending keyststrokes, use Command-'.'.
When the dialog for entering key macros comes up, you have three options: select a key, get help, show a list of macros currently associated with keys, or quit the dialog. A prompt appears saying "You may press a key-combination to modify the macro for that key..." If you press a key-combination, the dialog will show you the name of the key, and will allow you to enter actions (text and commands) you want the key-combination to produce. If there is a key macro associated with that key, the Delete key will be turned on, and the actions associated with the key will be displayed. Note that holding down the mouse button when you press the key-combination will identify the key as an "Alt-key," and such a macro will only be matched if the "ALT" state is set using the "!CA" command documented below (this allows you to switch keyboard configurations with a keystroke, and is used with library keymapping--see the "ALA" dataComet configuration document for an example of extensive key remapping). When the "ALT" state is on, the boxed "M" which shows that key macros are on changes to an "m".
You can modify the macro text by entering new text or using copy and paste with the Command-C and Command-V keys. Command-. cancels your modifications to the key macro. When you are finished, you must press the Set button if you want the changes to take effect. The program will then alert you if your entry has errors in the length of the codes. (PLEASE NOTE that the codes are not checked for validity until you execute a key macro by typing the key when you have quit the dialog and Key Macros are set on! Alerts will then inform you of any errors.) If there is no error, the macros are updated immediately; there is no need to save the configuration to save the key macros in the document. If you decide not to change the text, you should press the Cancel button. You can then quit if you wish, or add, remove, or modify other keys.
Text which you enter in the key macro window can be interpreted as either plain text or commands. Individual characters stand for themselves--except for '!' & '\', which can be entered by using '!!' and '\\'. These two characters are special: '!' is used to introduce a command; '\' is used to enter a number, specified using three decimal digits, such as "\010". This numeric entry can be used either in place of a character, or to enter a decimal numeric value.
ASCII control characters can be entered by pressing the option key and the character ('a' through 'z', Space, '[', ']', '\', '@', '^', '_', or '?').
Ordinary text can be entered directly in the text-editing field of the dialog. Commands are entered as a '!' (exclamation point) followed by a pair of characters; the first character selects a class of action, and the second the particular type of this action. In IBM mode, the macro dialogs present buttons to perform input of all the IBM function keys. (PLEASE NOTE that dataComet does not automatically map the Return key to produce an "Enter," so you need to press the "Enter" button to send an Enter command to the host using a macro.) The action classes and associated characters available in both ASCII and the "IBM Keymapping" modes are as follows:
Search for a string: (/) followed by a string terminated with another macro or null ASCII character.
To make a selection: you must use four commands to set a selection range, each of which uses a number to specify the position on the screen numbered from 0; when all four codes have been received, the selection will be made.
!S\000 selection start Y position, followed by the position
number;
!T\000 selection start X position, followed by the position
number;
!U\023 selection end Y position, followed by the position
number;
!V\079 selection end X position, followed by the position
number.
!S\000!T\000!U\002!V\079
Shift selection left: (<) followed by the number of spaces to shift the selection.
!<\005
Shift selection right: (>) followed by the number of spaces to shift the selection.
!>\010
Set selection length: (#) followed by the new length.
Macros from !\000 to !\019 correspond to the menu items from left to right, with the items numbered from 1. E.g., "!\000\001" executes the "About dataComet" menu item. NOTE that menu items are subject to being moved, so these mapping may change. (Macro recording provides an easy way to get an item's macro equivalent, since menu items selected are included in the macro.)
Record user input as macro commands: (R) followed by a code:
!RB begin recording;
!RE end recording and place the recording in the scrap for
pasting into the .edit window or key macro dialog.
Delay: (D) followed by the number of seconds to wait specified as \nnn, e.g. "!D\001".
Loop: (L) followed by the number of times to repeat the sequence of macro commands which follows; this sequence must be terminated by an entry containing "!L\000" (loop zero). Using '\255' for the count will cause the loop to continue until the Command-. "cancel" key is pressed.
!L\255echo hello!L\000
Match String: Delay session macro processing until host output matches string: (Z) followed by a number indicating the number of seconds to wait before aborting; if the number is '\255', it waits forever if the string is not matched. This entry is followed by a list of characters to match, terminated by any non-character macro command (usually a Delay entry). You might use this in a login as follows...
Query the user to enter a string: (Q) followed by P, followed by the prompt, followed by a "!Q". macro command to terminate the prompt string. The user's response will be sent out to the host. To enter a password, use "!QS" to replace the characters with dots. Both the query and the response must be under 256 characters.